package filesystem.simplefactory.factory;

import filesystem.simplefactory.FileSave;
import filesystem.simplefactory.impl.DBSaveImpl;
import filesystem.simplefactory.impl.FileSaveImpl;

public class SaveTypeFactory {
    public static String SAVE_DB="db";
    public static String SAVE_FILE ="file";
    public static FileSave getSaveConnect(String type){
        if (type==null){
            throw new IllegalArgumentException("参数不能为空");
        }
        if (type.equals(SAVE_DB)){
            return new DBSaveImpl();
        }
        if (type.equals(SAVE_FILE)){
            return new FileSaveImpl();
        }
        return null;
    }
}
